import com.sun.source.tree.NewClassTree;
import org.w3c.dom.ls.LSOutput;

//外部类
class OutClass{
    public int data1 = 1;
    public int data2 = 2;

    public static  int data3 = 3;

//    静态内部类
    static class InnerClass{
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;

        public void test(){
            System.out.println("test方法被执行了");

//            System.out.println(data1);/*报错*//* 在静态内部类不能直接访问外部类的非静态成员*/
//            重新实例化才行
            OutClass outClass = new OutClass();
            System.out.println(outClass.data1);
            System.out.println(outClass.data2);
            System.out.println(data3);/*静态成员就可以直接访问*/

            System.out.println(data4);
        }
}
}

public class Test {
    public static void main(String[] args) {
//            这样实例化静态内部类对象
            OutClass.InnerClass innerClass = new OutClass.InnerClass() ;
            innerClass.test();

    }
}

